const {mysql} = require('../qcloud')
//首页搜索
module.exports = async (ctx) => {
  const {search} = ctx.request.query
  console.log('159',search)
  try{
    const strategy_mysql1 = await mysql('strategy')
                              .select('sid','sbiao','ssrc','nssrc','szheng','wx_name')//sid攻略的id 
                              // .whereILike("sbiao", openid)//删掉该句即可显示所有
                              .where(search,'like','%true')//模糊查找
                              .orderBy('sid','desc')
    // 执行成功返回的数据
    ctx.state.data = {
      strategy_mysql1
    }
  }catch(e){
    // 执行失败返回的数据
    ctx.state = {
      code: -1,
      data: {
        msg: '获取失败' + e.sqlMessage
      }
    }
  }
}
